/*
 * IntegerEx.cpp
 *
 *  Created on: Aug 7, 2011
 *      Author: dino
 */

#include "IntegerEx.h"

IntegerEx::IntegerEx(long value) : value(value) {
}

IntegerEx::~IntegerEx() {
}

bool IntegerEx::simplify() {
	return false;
}

Expression* IntegerEx::add(Expression* expression) {
	return expression->addToInteger(this);
}
Expression* IntegerEx::substract(Expression* expression) {
	return expression->substractFromInteger(this);
}

Expression* IntegerEx::addToInteger(IntegerEx* integer) {
	return new IntegerEx(integer->getValue() + this->value);
}

Expression* IntegerEx::substractFromInteger(IntegerEx* integer) {
	return new IntegerEx(integer->getValue() - this->value);
}

void IntegerEx::toString(ostream& out) {
	out<<this->value;
}
